import React from 'react'
import { Form, Input, Select } from 'antd'
const { Option } = Select
function categoryForm(props) {
  const { getFieldDecorator } = props.form
  return (
    <Form className="login-form">
      <Form.Item label="一级类别">
        {getFieldDecorator('parentId', {
          rules: [{ required: true, message: '请选择一级类别' }],
          initialValue: props.setForm.parentId,
        })(
          <Select placeholder="请选择一级类别" disabled={props.selectDisabled}>
            <Option value="0">一级类别</Option>
            {props.parentCategorys.map((v, i) => {
              return (
                <Option value={v._id} key={v._id}>
                  {v.name}
                </Option>
              )
            })}
          </Select>
        )}
      </Form.Item>
      <Form.Item label="产品类别名称">
        {getFieldDecorator('categoryName', {
          initialValue: props.setForm.name,
          rules: [{ required: true, message: '请填写产品类型名称' }],
        })(<Input placeholder="请输入产品类型名称" />)}
      </Form.Item>
    </Form>
  )
}
export default Form.create()(categoryForm)
